<template>
  <section>
    <div>
      <p>
        账号<input v-model="account">
      </p>
      <p>
        密码<input v-model="password">
      </p>
    </div>
    <div>
      <button @click="login">登录</button>
      <button @click="register">注册</button>
    </div>
  </section>
</template>

<script>
import {saveUser, login} from '@/services/api'
export default {
  data () {
    return {
      account: '',
      password: ''
    }
  },
  methods: {
    async login () {
      await login({
        account: this.account,
        password: this.password
      })
    },
    async register () {
      await saveUser({
        account: this.account,
        password: this.password
      })
    }
  }
}
</script>

<style scoped>

</style>
